from haystack import indexes
from .models import Course


class CourseIndex(indexes.SearchIndex, indexes.Indexable):
    '''

    Course索引类

    '''
    text = indexes.CharField(document=True, use_template=True)

    def get_model(self):
        '''返回建立索引的模型类'''
        return Course
    def index_queryset(self, using=None):
        '''返回建立索引的数据查询及'''
        return self.get_model().objects.all()